define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {

		function get_data_orderlist(result) {
			if(false) {
				result = '{"success": true,"msg": "","result":'+ 
				'{"store_name": "世达","order_count": 100,"order_money": 1000,"order": ['+
				'{"id": "123456789","buyer_name": "买家1","count": 10,"total_amount": 100},'+
			    '{"id": "223456789","buyer_name": "买家2","count": 90,"total_amount": 900}]},'+
					'"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		//返回信息
		return {
			order_list: function(nPage,store_id,order_id,goods_name,time,ordertype,callback,calldone) {
				//				//post请求
				Http.post({
						method: 'member.agenter.orderlist',
						store_id: store_id,
						order_id: order_id,
						goods_name: goods_name,
						time: time,
						ordertype: ordertype,
						picSize:'CS',
						pagelimit:10,
						nPage:nPage,

					},
					function(result) {
						//请求成功
						if(callback)
							callback(get_data_orderlist(result).result);

					},
					function(e) {
						//请求异常
					},
					function() {
						//请求完成，一般不做什么事情
						if(calldone)
						calldone();
					}
				);
			},

		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Distributor_order", factory);
});